package com.drivemanage.controller;

import java.io.IOException;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import com.drivemanage.entry.DriveResult;
import com.drivemanage.service.TestService;

/** 
 * 
 */
@Controller
@RequestMapping("/test")
public class TestController {

    @Resource
    private TestService testservice;

    /**
     * 分组查询车辆品牌
     * 
     * @return
     */
    @ResponseBody
    @RequestMapping("/getCarBond.do")
    public DriveResult getCarInfo() {
        return testservice.getCarBond();
    }

    /**
     * 三联菜单
     */
    @ResponseBody
    @RequestMapping("/getCarlink.do")
    public DriveResult getCarLink() {
        return testservice.getCarLink();
    }

    /**
     * 上传图片
     */
    @ResponseBody
    @RequestMapping("/changeandimg.do")
    public DriveResult changeAndImg(@RequestParam("carpic") MultipartFile carpic, HttpServletRequest request,
            HttpServletResponse response) throws IOException {
        return testservice.changeAndImg(carpic, request, response);
    }

    @ResponseBody
    @RequestMapping("/queryInfo.do")
    public DriveResult queryInfo(String pinpai, String chexi, String chexingming) {
        return testservice.queryAllInfo(pinpai, chexi, chexingming);
    }
}
